home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-18 | 465 b | 33 lines | [TEXT/CWIE] |
- // Timeout.h
-
- #ifndef Timeout_h
- #define Timeout_h
-
- #ifndef Waiter_h
- #include "Waiter.h"
- #endif
- #ifndef Race_h
- #include "Race.h"
- #endif
-
- /*
- A Timeout wraps a timer around a Task. You use it like this:
- Timeout timeout;
- timeout( someTask, Microsecs(5) ) // or Millisecs(5)
- */
-
- class Timeout
- {
- private:
- Waiter wait;
- Race2 race;
-
- public:
- Task *operator()( Task *task, WaitLength time )
- {
- return race( task, wait( time ), 1 );
- }
- };
-
- #endif
-